package com.zc58s.concurrent.executor.state;


import java.util.concurrent.TimeUnit;

/**
 * 在while(true)循环中调用TimeUnit.SECONDS.sleep(long)方法来验证线程的TIMED_WARTING状态，代码如下所示。
 *
 * @author fujc-dev@qq.com
 */
public class WaitingTime implements Runnable {

    @Override
    public void run() {
        while (true) {
            waitSecond(200);
        }
    }

    //线程等待多少秒
    public static void waitSecond(long seconds) {
        try {
            TimeUnit.SECONDS.sleep(seconds);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
